#!/usr/bin/env python
#-*- coding: utf-8 -*-
"""
@file:1.py
@author:1740681566@qq.com
@date:	2018/04/20
@version: 
    v1.1 2018-04-20 fix bug
    v1.0 2018-04-20 create
@input:	需要就写，不需要就不写
@output:需要就写，不需要就不写

模块功能简述,Get a list of maximum `limit` number of users with user id starting from `start_uid`
"""

singer_song = {1: {"李圣杰": ['痴心绝对']}, 2: {"张韶涵": ['阿刁', '隐形的翅膀']}, 3: {"许嵩":
    ["素颜"]}, 4: {"汪苏泷": ["风度"]}, 5: {"张杰":  ["天下"]}}

menu = {1: "增加歌手", 2: "显示歌手名单", 3: "删除歌手（也可输入编号）", 4: "显示歌库", 5: "删除歌曲", 6:
    "增加歌曲", 7:"统计功能（歌手数和歌曲数）", 8: "查询可手是否在名单中", 9: "查询歌曲是否在歌单中", 10: "退出菜单"}
str1 = "@@欢迎来到chart topping歌曲排行榜@@"
print(str1.center(150))
for i in menu:
    print(i, menu[i], end='    ')
print()
count = 6
while True:
    user = int(input("请你输入你要的功能，谢谢："))
    if user == 1:
        add_singer_name = input("请输入你要增加歌手的名字：")
        singer_song[count]={add_singer_name: []}
        count += 1
        continue
    if user == 2:
        for i in singer_song:
            for j in singer_song[i]:
                print(j)
        continue
    if user == 3:
        del_singer_name = input("请你输入你要删除的歌手：")
        if del_singer_name.isdigit():
            del singer_song[int(del_singer_name)]
            continue
        else:
            for i in singer_song:
                for j in singer_song[i]:
                    if del_singer_name == j:
                        del singer_song[i]
    if user == 4:
        for i in singer_song:
            for j in singer_song[i]:
                print(singer_song[i][j])
        continue
    if user == 5:
        del_song_name = input("请输入你要删除的歌曲名：")
        for i in singer_song:
            for j in singer_song[i]:
                if del_song_name in singer_song[i][j]:
                    singer_song[i][j].remove(del_song_name)
        continue
    k = 0
    if user == 6:
        add_singer_name = input("请输入你要增加的歌手：")
        add_song_name = input("请输入你要增加的歌曲名：")
        for i in singer_song:
            for j in singer_song[i]:
                if add_singer_name == j:
                    singer_song[i][j].append(add_song_name)
                    k = 1
        if k == 0:
            singer_song[count] = {add_singer_name: [add_song_name]}
            count += 1
            continue
    singer_count = 0
    song_count = 0
    if user == 7:
        for i in singer_song:
            singer_count += 1
            for j in singer_song[i]:
                song_count += len(singer_song[i][j])
        print("现在有{}位歌手，有{}首歌曲".format(singer_count, song_count))
    find = 0
    if user == 8:
        find_name = input("请你输入你查询的歌手名：")
        for i in singer_song:
            for j in singer_song[i]:
                if find_name == j:
                    find = 1
        if find == 1:
            print("您输入的歌手在歌单中")
        else:
            print("您输入的歌手不在歌单中")
    find = 0
    if user == 9:
        find_song = input("请你输入你查询的歌手名：")
        for i in singer_song:
            for j in singer_song[i]:
                if find_song in singer_song[i][j]:
                    find = 1
        if find == 1:
            print("您输入的歌曲在歌单中")
        else:
            print("您输入的歌曲不在歌单中")
    if user == 10:
        break